home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / Quick C 2.0 / INCLUDE / STDIO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-05  |  4.2 KB  |  166 lines

  1. /***
  2. *stdio.h - definitions/declarations for standard I/O routines
  3. *
  4. *    Copyright (c) 1985-1989, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    This file defines the structures, values, macros, and functions
  8. *    used by the level 2 I/O ("standard I/O") routines.
  9. *    [ANSI/System V]
  10. *
  11. ****/
  12.  
  13.  
  14. #ifndef _SIZE_T_DEFINED
  15. typedef unsigned int size_t;
  16. #define _SIZE_T_DEFINED
  17. #endif
  18.  
  19. #ifndef _VA_LIST_DEFINED
  20. typedef char *va_list;
  21. #define _VA_LIST_DEFINED
  22. #endif
  23.  
  24. #ifndef NO_EXT_KEYS    /* extensions enabled */
  25.     #define _CDECL    cdecl
  26.     #define _NEAR    near
  27. #else /* extensions not enabled */
  28.     #define _CDECL
  29.     #define _NEAR
  30. #endif /* NO_EXT_KEYS */
  31.  
  32.  
  33. /* buffered I/O macros */
  34.  
  35. #define  BUFSIZ 512
  36. #define  _NFILE 20
  37. #define  EOF    (-1)
  38.  
  39. #ifndef    _FILE_DEFINED
  40. #define  FILE    struct _iobuf
  41. #define    _FILE_DEFINED
  42. #endif
  43.  
  44. /* P_tmpnam: Directory where temporary files may be created.
  45.  * L_tmpnam size =  size of P_tmpdir
  46.  *        + 1 (in case P_tmpdir does not end in "\\")
  47.  *        + 6 (for the temp number string)
  48.  *         + 1 (for the null terminator)
  49.  */
  50.  
  51. #define  P_tmpdir "\\"
  52. #define  L_tmpnam sizeof(P_tmpdir)+8
  53.  
  54. #define  SEEK_CUR 1
  55. #define  SEEK_END 2
  56. #define  SEEK_SET 0
  57.  
  58. #define  FILENAME_MAX 63
  59. #define  FOPEN_MAX 20
  60. #define  SYS_OPEN 20
  61. #define  TMP_MAX 32767
  62.  
  63.  
  64. /* define NULL pointer value */
  65.  
  66. #if (defined(M_I86SM) || defined(M_I86MM))
  67. #define  NULL    0
  68. #elif (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
  69. #define  NULL    0L
  70. #endif
  71.  
  72.  
  73. /* define file control block */
  74.  
  75. #ifndef    _IOB_DEFINED
  76. extern FILE {
  77.     char *_ptr;
  78.     int   _cnt;
  79.     char *_base;
  80.     char  _flag;
  81.     char  _file;
  82.     } _NEAR _CDECL _iob[];
  83. #define    _IOB_DEFINED
  84. #endif
  85.  
  86. #define  fpos_t  long    /* file position variable */
  87.  
  88. #define  stdin    (&_iob[0])
  89. #define  stdout (&_iob[1])
  90. #define  stderr (&_iob[2])
  91. #define  stdaux (&_iob[3])
  92. #define  stdprn (&_iob[4])
  93.  
  94. #define  _IOREAD    0x01
  95. #define  _IOWRT     0x02
  96.  
  97. #define  _IOFBF     0x0
  98. #define  _IOLBF     0x40
  99. #define  _IONBF     0x04
  100.  
  101. #define  _IOMYBUF    0x08
  102. #define  _IOEOF     0x10
  103. #define  _IOERR     0x20
  104. #define  _IOSTRG    0x40
  105. #define  _IORW        0x80
  106.  
  107. #define getc(f)     (--(f)->_cnt >= 0 ? 0xff & *(f)->_ptr++ : _filbuf(f))
  108. #define putc(c,f)    (--(f)->_cnt >= 0 ? 0xff & (*(f)->_ptr++ = (char)(c)) \
  109.                 :  _flsbuf((c),(f)))
  110. #define getchar()    getc(stdin)
  111. #define putchar(c)    putc((c),stdout)
  112.  
  113. #define feof(f)     ((f)->_flag & _IOEOF)
  114. #define ferror(f)    ((f)->_flag & _IOERR)
  115. #define fileno(f)    ((int)(unsigned char)(f)->_file)
  116.  
  117. /* function prototypes */
  118.  
  119. int _CDECL _filbuf(FILE *);
  120. int _CDECL _flsbuf(int, FILE *);
  121. void _CDECL clearerr(FILE *);
  122. int _CDECL fclose(FILE *);
  123. int _CDECL fcloseall(void);
  124. FILE * _CDECL fdopen(int, char *);
  125. int _CDECL fflush(FILE *);
  126. int _CDECL fgetc(FILE *);
  127. int _CDECL fgetchar(void);
  128. int _CDECL fgetpos(FILE *, fpos_t *);
  129. char * _CDECL fgets(char *, int, FILE *);
  130. int _CDECL flushall(void);
  131. FILE * _CDECL fopen(const char *, const char *);
  132. int _CDECL fprintf(FILE *, const char *, ...);
  133. int _CDECL fputc(int, FILE *);
  134. int _CDECL fputchar(int);
  135. int _CDECL fputs(const char *, FILE *);
  136. size_t _CDECL fread(void *, size_t, size_t, FILE *);
  137. FILE * _CDECL freopen(const char *, const char *, FILE *);
  138. int _CDECL fscanf(FILE *, const char *, ...);
  139. int _CDECL fsetpos(FILE *, const fpos_t *);
  140. int _CDECL fseek(FILE *, long, int);
  141. long _CDECL ftell(FILE *);
  142. size_t _CDECL fwrite(const void *, size_t, size_t, FILE *);
  143. char * _CDECL gets(char *);
  144. int _CDECL getw(FILE *);
  145. void _CDECL perror(const char *);
  146. int _CDECL printf(const char *, ...);
  147. int _CDECL puts(const char *);
  148. int _CDECL putw(int, FILE *);
  149. int _CDECL remove(const char *);
  150. int _CDECL rename(const char *, const char *);
  151. void _CDECL rewind(FILE *);
  152. int _CDECL rmtmp(void);
  153. int _CDECL scanf(const char *, ...);
  154. void _CDECL setbuf(FILE *, char *);
  155. int _CDECL setvbuf(FILE *, char *, int, size_t);
  156. int _CDECL sprintf(char *, const char *, ...);
  157. int _CDECL sscanf(const char *, const char *, ...);
  158. char * _CDECL tempnam(char *, char *);
  159. FILE * _CDECL tmpfile(void);
  160. char * _CDECL tmpnam(char *);
  161. int _CDECL ungetc(int, FILE *);
  162. int _CDECL unlink(const char *);
  163. int _CDECL vfprintf(FILE *, const char *, va_list);
  164. int _CDECL vprintf(const char *, va_list);
  165. int _CDECL vsprintf(char *, const char *, va_list);
  166.